<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/pages/safeai/jsp/common/taglibs.jsp"%> 
<html>
	<head>
		<title>员工管理</title>
		<%@ include file="/pages/safeai/jsp/common/meta.jsp"%>
	<link href="${ctx}/css/safeai/together.css" rel="stylesheet" type="text/css">
	    <style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
        </style>
</head>
	<body>
		<%@ include file="/pages/safeai/jsp/common/taglibs.jsp"%>
	<form action="${ctx}/operator.do?method=updateOperator" method="post" name="operatorForm">
		 <table width="520px" align="center"> 
			<tr>
                	<th colspan="2" height="25px">员工管理</th>
            </tr>
			<tr>
				<td class="td_01" width="130px">用户名：</td>
				<td class="td_04"><bean:write name="operator" property="userid" /></td> 
				<input type="hidden" name="operator.userid" value="<bean:write name="operator" property="userid" />"/>		    </tr>
			<tr>
				<td class="td_01">密&nbsp;&nbsp;&nbsp;&nbsp;码：</td>
				<td class="td_04"><input type="text" id="passwd" name="operator.passwd" /><span class="STYLE1">*</span>如不输入密码,则保持原密码不变<input type="hidden" id="pTag" name="passwordTag" value="<bean:write name="operator" property="passwd"/>" /></td> 
			</tr>
			<tr>
				<td class="td_01">姓&nbsp;&nbsp;&nbsp;&nbsp;名：</td>
				<td class="td_04"><input type="text" id="username" name="operator.username" value="<bean:write name="operator" property="username"/>"/><span class="STYLE1">*</span></td> 
			</tr>
			<tr>
				<td class="td_01">角&nbsp;&nbsp;&nbsp;&nbsp;色：</td>
				<td class="td_04">
					<select name="operator.roleid"> 
						<logic:iterate id="role" name="roleList"> 
							<logic:equal name="operator" property="roleid" value="${role.roleid}">
								<option value="<bean:write name="role" property="roleid"/>" selected><bean:write name="role" property="rolename"/></option>
						    </logic:equal>
							<logic:notEqual name="operator" property="roleid" value="${role.roleid}">
								<option value="<bean:write name="role" property="roleid"/>"><bean:write name="role" property="rolename"/></option>
						    </logic:notEqual>
					    </logic:iterate>
				    </select>			    </td> 
			</tr>
			<tr>
				<td class="td_01">邮&nbsp;&nbsp;&nbsp;&nbsp;箱：</td>
				<td class="td_04"><input type="text" name="operator.mail" value="<bean:write name="operator" property="mail"/>"/></td> 
			</tr>
			<tr>
				<td class="td_01">电&nbsp;&nbsp;&nbsp;&nbsp;话：</td>
				<td class="td_04"><input type="text" name="operator.phone" value="<bean:write name="operator" property="phone"/>"/></td>  
			</tr>
			<tr>
				<td class="td_01">状&nbsp;&nbsp;&nbsp;&nbsp;态：</td>
				<td class="td_04">
					<logic:equal name="operator" property="ostate" value="0">
						<input type="radio" name="operator.ostate" value="0" checked>正常<input type="radio" name="operator.ostate" value="1">不可用					</logic:equal>
					<logic:equal name="operator" property="ostate" value="1">
						<input type="radio" name="operator.ostate" value="0">是<input type="radio" name="operator.ostate" value="1" checked>否					</logic:equal>			    </td> 
			</tr>
			<tr>
           		<td colspan="2" align="center">${operMsg}</td>
   			</tr>
			<tr> 
				<td colspan="2" align="center"><input type="submit" class="btn" value="修改" onclick="return sub();"/></td>
			</tr>
	    </table>
	</form> 
	</body>
</html>
<script language="javascript"> 
	function isCnAndEnAndNumber(str){   
		var pattern_cn = /^([\uFE30-\uFFA0]|[_\a-zA-Z0-9]|[\s])*$/gi;
		if(pattern_cn.test(str)){ 
	    	return true;    
	    }else{     
        	return false;   
        }
     }
	function sub(){
		 var passwd = window.operatorForm.passwd.value;
		// var passwprd = document.getElementById("pTag").value; 
		 var username = window.operatorForm.username.value;
		 
		// if(passwd == null || passwd == ""){
		 //	window.operatorForm.passwd.value = passwprd;
		 	//alert("请输入密码!");
		 	//window.operatorForm.passwd.focus();
		 	//return false;
		// }
		 
		 if(username == null || username == ""){
		 	alert("请输入姓名!");
		 	window.operatorForm.username.focus();
		 	return false;
		 }
		 if(username.indexOf(" ")!=-1){
		 	alert("姓名中不能包含空格!");
		 	return false;
		 }
		 if(!isCnAndEnAndNumber(passwd)){
		 	alert("密码只能由英文字母数字下划线组成！");
		 	return false;
		 }
		 if(passwd.indexOf(" ")!=-1){
		 	alert("密码中不能包含字空格!");
		 	return false;
		 }
	}
</script>